<template>
	<view class="page" :style="{minHeight:windowHeight+'px'}">
		<view class="top-head">
			<view class="head-l">
				<image src="../../../static/jiaotou1.png" @click="gotoPage('/pages/home/home')"></image>
			</view>
			<view class="head-title">今日车单</view>
			<view class="head-r"></view>
		</view>
		<view style="height: 80rpx;"></view>
		<block v-for="(item,index) in 3" :key="index" >
			<view class="list-item">
				<view class="item-info">
					<view>
						永州 林灵 -> 东莞 麻涌
					</view>
					<text>刚刚</text>
				</view>
				<view class="item-info1">
					<view>
						<text>16座</text>
						<text>|</text>
						<text>到付</text>
					</view>
					<view>约1km</view>
				</view>
				<view class="item-price">
					￥<text>39000</text> /趟
				</view>
				<view class="user-wrap">
					<view class="user-box">
						<view class="user-avatar">
							<image src="../../../static/app/logo.png" mode=""></image>
						</view>
						<view class="user-info">
							<view class="user-name">
								<text>桂林大聪网络有限公司</text>
								<image src="../../../static/app/vip1.png" mode=""></image>
							</view>
							<text>交易234 好评率95%</text>
						</view>
					</view>
					<view class="item-btn" @click="gotoToday(index)">
						去抢单
					</view>					
				</view>
				<view class="list-line"></view>
			</view>
		</block>
		<!-- <view class="list" v-for="(item,index) in singleCar" :key="index" >
			<view class="list-item">
				<view class="item-info">
					<view>
						{{item.starting}} -> {{item.destination}}
					</view>
					<text>{{item.issueTime}}</text>
				</view>
				<view class="item-info1">
					<view>
						<text>{{item.seat}}</text>
						<text>|</text>
						<text>{{item.payType}}</text>
					</view>
					<view>约1km</view>
				</view>
				<view class="item-price">
					￥<text>{{item.price}}</text> /趟
				</view>
				<view class="user-wrap">
					<view class="user-box">
						<view class="user-avatar">
							<image :src="item.companyLogo" mode=""></image>
						</view>
						<view class="user-info">
							<view class="user-name">
								<text>{{item.companyName}}</text>
								<image src="../../../static/app/vip1.png" mode=""></image>
							</view>
							<text>交易{{item.number}} 好评率{{item.feedBack}}%</text>
						</view>
					</view>
					<view class="item-btn" @click="gotoToday(type,item.singleCarId)">
						去抢单
					</view>					
				</view>
				<view class="list-line"></view>
			</view>
		</view> -->
		<!-- <view class="list" v-for="(item,index) in orderList" :key="index" >
			<view class="list-item">
				<view class="item-info">
					<view>
						{{item.starting}} -> {{item.destination}}
					</view>
					<text>{{item.issueTime}}</text>
				</view>
				<view class="item-info1">
					<view>
						<text>{{item.seat}}</text>
						<text>|</text>
						<text>{{item.payType}}</text>
					</view>
					<view>约{{item.distrance}}km</view>
				</view>
				<view class="item-price">
					￥<text>{{item.price}}</text> /趟
				</view>
				<view class="user-wrap">
					<view class="user-box">
						<view class="user-avatar">
							<image :src="item.companyLogo" mode=""></image>
						</view>
						<view class="user-info">
							<view class="user-name">
								<text>{{item.companyName}}</text>
								<image v-if="item.isVip == 1" src="../../../static/app/vip1.png" mode=""></image>
							</view>
							<text>交易{{item.tradesNum}} 好评率{{item.feedBack}}%</text>
						</view>
					</view>
					<view class="item-btn" @click="gotoToday(type,item.car_id)">
						去抢单
					</view>					
				</view>
				<view class="list-line"></view>
			</view>
		</view> -->
		<!-- 没有记录 -->
		<!-- <view class="null d-c-c p30" v-if="listDate == 0 ">
			<text class="iconfont icon-wushuju"></text>
			<text class="cont">亲，暂无相关记录哦</text>
		</view> -->
		<!-- <uni-load-more v-else :loadingType="loadingType"></uni-load-more> -->
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more.vue';
	export default {
		components: {
			uniLoadMore
		},
		data() {
			return {
				isShow: false,
				/* 数据列表 */
				listDate:0,
				type:1,//车单的类型
				singleCar:[
					{ 
						singleCarId:1001,
						starting:'永州 林灵',
						destination:' 东莞 麻涌',
						issueTime:'刚刚',
						seat:'16座',
						payType:'到付',
						price:3999,
						companyName:'桂林大聪网络有限公司',
						companyLogo:'../../../static/app/logo.png',
						feedBack:'99',
						number:'66',
					},
					{
						singleCarId:1002,
						starting:'永州 林灵',
						destination:' 东莞 麻涌',
						issueTime:'刚刚',
						seat:'18座',
						payType:'到付',
						price:6999,
						companyName:'桂林大聪网络有限公司',
						companyLogo:'../../../static/app/logo.png',
						feedBack:'99',
						number:'88',
					},
				],
				windowHeight:'',
				car_id:'',
				orderList:[],
			};
		},
		onLoad(e) {
			uni.getSystemInfo({
				success: (res) => {
					this.windowHeight = res.windowHeight;
				}
			});
			//if(e.select == 1){
				//this.type = e.type;
				this.getData();
				//console.log(this.type)
			//}
			console.log(e)
			
		},
		computed: {
			/*加载中状态*/
			loadingType() {
				if (this.loading) {
					return 1;
				} else {
					if (this.orderList.length != 0 && this.no_more) {
						return 2;
					} else {
						return 0;
					}
				}
			}
		},
		methods:{
			gotoToday(type,car_id){
				uni.navigateTo({
					url:'/pages/home/grab/grab?select=1&&type=' + type + '&&car_id='+ car_id
				})
			},
			/*跳转页面*/
			gotoPage(path) {
				let self = this;
				if(path.startsWith('/')){
					uni.navigateTo({
						url: path
					});
				}else{
					self[path]();
				}
			},
			/*获取车单数据*/
			getData() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				console.log(self.type);
				self._get('car.order/order_list',
				{
					type:1
				}, 
				
				function(res) {
					console.log(111)
					console.log(res.data.orderlist);
					self.orderList = res.data.orderlist;
					
					uni.hideLoading();
				});
			},
		}
	}
</script>

<style lang="scss">
@import 'monthCar.scss'
</style>
